<div class="p-2">
    <PushRepos />
    <Remove :des="des" :selects="selectedRows" />
    <div class="row">
        <div class="col-12">
            <div class="page-toolbar pt-0 pl-0 pr-0">
                <div class="loading-layer" v-if="loading"></div>
                <button type="button" class="btn btn-dark" @click="tableData()" :disabled="loading">
                    <i class="mdi mdi-refresh align-middle"></i>
                </button>
                <button type="button" class="btn btn-dark" @click="pushRepos()">
                    <i class="mdi mdi-upload"></i>
                    推送镜像
                </button>
                <button type="button" class="btn btn-light" @click="tableRemove()"
                    :disabled="selectedRows.length != 1"
                >
                    <i class="mdi mdi-close align-middle"></i>
                    删除
                </button>
                <div class="form-group">
                    <input class="form-control" placeholder="搜索镜像仓库" @keydown.13="tableData()" v-model="search" />
                </div>
            </div>
            <a-table
                class="text-norwap"
                :scroll="{ x: true }"
                :columns="table.cols"
                :dataSource="table.rows"
                :pagination="pagination"
                :loading="loading"
                :locale="locale"
                :rowKey="records => records.id"
                :rowSelection="{ onChange: tableOnSelect, selectedRowKeys: selectedRowKeys, }"
                @change="tableChange"
            >
                <template slot="id" slot-scope="id">
                    <span class="text-muted">{{ id }}</span>
                </template>
                <template slot="name" slot-scope="name, row">
                    <router-link
                        :to="{name: 'repos-detail', params: {project: row.name.split('/')[0], repo: row.name.split('/').slice(1).join('/')}}"
                        class="text-primary"
                    ><b>{{ name }}</b></router-link>
                </template>
                <template slot="update_time" slot-scope="update_time">{{ update_time | toLocalTime }}</template>
                <template slot="creation_time" slot-scope="creation_time">
                    <span class="text-muted">{{ creation_time | toLocalTime }}</span>
                </template>
            </a-table>
        </div>
    </div>
</div>
